<?php
#
# author: Cody Sorgenfrey
# (c)2012 South Hill Calvary Chapel
#

include_once("../mysql/database_info.php");
include_once("common.php");
include_once("../mysql/common.php");

if ($_GET['id'] && $_GET['table']){

	connect_select_test("people");

	$query="SELECT * FROM `".$_GET['table']."` WHERE `id`='".$_GET['id']."'";

	$result=mysql_query($query) or die (mysql_error());
	
	$personArray = mysql_fetch_array($result);

	$title = $personArray['first']." ".$personArray['last']; 
	$meta_key= $personArray['title'];
	$meta_desc= "How to contact ".$personArray['first']." ".$personArray['last']." at South Hill Calvary Chapel.";
	$morehtml= NULL;
	$morejava= NULL;
	
	startPage($title, $meta_key, $meta_desc, $morehtml, $morejava);
	
	printf("<table style='width:%s;'>\n", "100%");
	
	printf("\t<tr>\n");
	
	printf("\t\t<td colspan='2'><h4>%s</h4></td>\n", $personArray['position']);
	
	printf("\t</tr>\n");
	
	printf("\t<tr>\n");
	
	printf("\t\t<td><p>Phone: %s</p></td>\n", $personArray['phone']);
	
	printf("\t\t<td><p>Email: <a href='mailto:%s;'>%s</a></p></td>\n", $personArray['email'], $personArray['email']);
	
	printf("\t</tr>\n");
	
	printf("</table>\n");
	
	endPage();
}
else {

	printf("<script type='text/javascript'>window.location.href = '/404Error.php';</script>");
}


?>